; Music of Meganova (1988) (Dinamic)
; Ripped by Megachur the 30/03/2008

	write "MEGANOVA.BIN"

music_date_rip	equ &1e38
music_adr	equ &8340
first_theme	equ 0
last_theme	equ 0

	read "music_header_v1_0.asm"

;#8340
	jr l83aa
	jr l834a
	jr l83a6
	jr l83c0
.l8349 equ $ + 1
.l8348
	db #00,#05
.l834a
	ld hl,(l0064)
	di
	ld (l8507),hl
.l8351
	ld (l8505),hl
.l8354
	ld hl,(l8505)
	ld iy,l8509
	ld b,#03
.l835d
	ld (iy+#00),#00
	ld (iy+#01),#00
	ld (iy+#08),#00
	ld e,(hl)
	inc hl
	ld d,(hl)
	inc hl
	ld a,e
	and d
	cp #ff
	jr nz,l8383
	ld a,(l8348)
	or a
	ld a,#00
	ld (l8348),a
	jr nz,l83aa
	ld hl,(l8507)
	jr l8351
.l8383
	ld (iy+#02),e
	ld (iy+#03),d
	ld de,#000c
	add iy,de
	djnz l835d
	ld e,(hl)
	inc hl
	ld d,(hl)
	inc hl
	ld (l8505),hl
	ld hl,l852d
	ex de,hl
	ld bc,#001e
	ldir
	ld hl,l840c
	ld (l7522),hl
.l83a6
	ld a,#28
	jr l83ac
.l83aa
	ld a,#18
.l83ac
	di
	ld (l8416),a
	ld a,#07
	ld c,#b8
	call l84e7
	ld a,#06
	ld c,#1f
	call l84e7
	jr l83ed
.l83c0
	ld a,(l0064)
	cp #02
	jr z,l83d5
	jr c,l83cf
	ld iy,l8521
	jr l83d9
.l83cf
	ld iy,l8509
	jr l83d9
.l83d5
	ld iy,l8515
.l83d9
	call l8403
	ret nz
	ld hl,(l0066)
	di
	ld (iy+#08),#01
	ld (iy+#0a),l
	ld (iy+#0b),h
	ei
	ret
.l83ed
	ld a,#08
	call l83fe
	ld a,#09
	call l83fe
	ld a,#0a
	call l83fe
.l83fc
	ei
	ret
.l83fe
	ld c,#00
	jp l84e7
.l8403
	ld l,(iy+#02)
	ld h,(iy+#03)
	ld a,h
	or l
	ret
;
.play_music
.l840c
;
	ld iy,l8509
	ld b,#03
.l8412
	push bc
	call l8403
.l8416
	jr z,l8462
	ld a,(iy+#01)
	or a
	jr z,l8423
	dec (iy+#01)
	jr l844c
.l8423
	ld a,(hl)
	dec a
	ld (iy+#01),a
	ld (iy+#00),#ff
	inc hl
	ld d,(iy+#06)
	call l84c3
	ld a,(hl)
	cp #ff
	jr nz,l8446
	pop bc
	xor a
	ld (l83fc),a
	call l8354
	ld a,#fb
	ld (l83fc),a
	ret
.l8446
	ld (iy+#02),l
	ld (iy+#03),h
.l844c
	ld a,(iy+#00)
	cp #09
	jr z,l8456
	inc (iy+#00)
.l8456
	call l84cf
.l8459
	ld de,#000c
	add iy,de
	pop bc
	djnz l8412
	ret
.l8462
	ld a,(iy+#08)
	or a
	jr z,l8459
	ld a,(iy+#09)
	or a
	jr z,l8473
	dec (iy+#09)
	jr l8459
.l8473
	ld a,(l8349)
	ld (iy+#09),a
	ld l,(iy+#0a)
	ld h,(iy+#0b)
	ld a,(hl)
	cp #ff
	jr nz,l848c
	ld (iy+#08),#00
	ld c,#00
	jr l84be
.l848c
	ld d,a
	bit 2,d
	jr z,l8495
	ld c,#a8
	jr l8497
.l8495
	ld c,#b8
.l8497
	ld a,#07
	call l84e7
	inc hl
	ld c,(hl)
	inc hl
	ld (iy+#0a),l
	ld (iy+#0b),h
	ld a,(iy+#06)
	push af
	call l84e7
	ld a,d
	and #03
	ld c,a
	pop af
	inc a
	call l84e7
	ld c,d
	srl c
	srl c
	srl c
	srl c
.l84be
	call l84e4
	jr l8459
.l84c3
	ld a,d
	ld c,(hl)
	inc hl
	call l84e7
	ld a,d
	inc a
	ld c,(hl)
	inc hl
	jr l84e7
.l84cf
	ld c,#00
	dec hl
	ld a,(hl)
	dec hl
	or (hl)
	jr z,l84e4
	ld e,(iy+#00)
	ld d,#00
	ld l,(iy+#04)
	ld h,(iy+#05)
	add hl,de
	ld c,(hl)
.l84e4
	ld a,(iy+#07)
.l84e7
	ld b,#f4
	out (c),a
	ld b,#f6
	in a,(c)
	or #c0
	out (c),a
	and #3f
	out (c),a
	ld b,#f4
	out (c),c
	ld b,#f6
	ld c,a
	or #80
	out (c),a
	out (c),c
	ret
.l8509 equ $ + 4
.l8507 equ $ + 2
.l8505
	db #00,#00,#00,#00,#00,#00,#00,#00
	dw l852d
.l8515 equ $ + 6
	db #00,#08,#00,#00,#00,#00,#00,#00
	db #00,#00
	dw l8537
.l8521 equ $ + 6
	db #02,#09,#00,#00,#00,#00,#00,#00
	db #00,#00
	dw l8541
.l852d equ $ + 6
	db #04,#0a,#00,#00,#00,#00,#0d,#0c
	db #0b,#0a,#09,#08,#07,#06,#05,#04
.l8537
	db #0d,#0c,#0b,#0a,#09,#08,#07,#06
.l8541 equ $ + 2
	db #05,#04,#0d,#0c,#0b,#0a,#09,#08
	db #07,#06,#05,#04,#c9,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00
.l8566
	dw l866f,l8810,l8ab0,l8b88
	dw l866f,l8819,l8ab0,l8b88
	dw l866f,l8819,l8ab9,l8b88
	dw l866f,l8819,l8ad7,l8b88
	dw l86a5,l887f,l8af5,l8b88
	dw l86db,l88e5,l8b13,l8b88
	dw l866f,l894b,l8ab9,l8b88
	dw l866f,l8966,l8ad7,l8b88
	dw l86a5,l8981,l8af5,l8b88
	dw l86db,l89a8,l8b13,l8b88
	dw l866f,l894b,l8ab9,l8b88
	dw l866f,l8966,l8ad7,l8b88
	dw l86a5,l8981,l8af5,l8b88
	dw l86db,l89a8,l8b13,l8b88
	dw l866f,l894b,l8ab9,l8b88
	dw l8711,l8a2c,l8b31,l8b88
	dw l8747,l89c6,l8b4f,l8b88
	dw l866f,l89c6,l8ab9,l8b88
	dw l866f,l8a47,l8ab9,l8b88
	dw l877d,l894b,l8ab9,l8b88
	dw l87ad,l8966,l8ad7,l8b88
	dw l87dd,l8981,l8af5,l8b88
	dw l86db,l89a8,l8b13,l8b88
	dw l877d,l894b,l8ab9,l8b88
	dw l87ad,l8966,l8ad7,l8b88
	dw l87dd,l8981,l8af5,l8b88
	dw l86db,l89a8,l8b13,l8b88
	dw l866f,l894b,l8ab9,l8b88
	dw l8711,l8a2c,l8b31,l8b88
	dw l8747,l89c6,l8b4f,l8b88
	dw l866f,l8a47,l8ab9,l8b88
	db #ff,#ff,#ff,#ff,#ff,#ff,#ff,#ff
	db #60,#00,#00,#06,#00,#00,#ff,#00
.l866f equ $ + 1
	db #00,#06,#24,#00,#06,#47,#00,#06
	db #47,#00,#06,#24,#00,#06,#47,#00
	db #06,#47,#00,#06,#24,#00,#06,#47
	db #00,#06,#47,#00,#06,#24,#00,#06
	db #47,#00,#06,#47,#00,#06,#24,#00
	db #06,#47,#00,#06,#47,#00,#06,#47
.l86a5 equ $ + 7
	db #00,#06,#00,#00,#ff,#00,#00,#06
	db #3c,#00,#06,#77,#00,#06,#77,#00
	db #06,#3c,#00,#06,#77,#00,#06,#77
	db #00,#06,#3c,#00,#06,#77,#00,#06
	db #77,#00,#06,#3c,#00,#06,#77,#00
	db #06,#77,#00,#06,#3c,#00,#06,#77
	db #00,#06,#77,#00,#06,#77,#00,#06
.l86db equ $ + 5
	db #00,#00,#ff,#00,#00,#06,#50,#00
	db #06,#9f,#00,#06,#9f,#00,#06,#50
	db #00,#06,#9f,#00,#06,#9f,#00,#06
	db #50,#00,#06,#9f,#00,#06,#9f,#00
	db #06,#50,#00,#06,#9f,#00,#06,#9f
	db #00,#06,#50,#00,#06,#9f,#00,#06
	db #9f,#00,#06,#9f,#00,#06,#00,#00
.l8711 equ $ + 3
	db #ff,#00,#00,#06,#35,#00,#06,#6a
	db #00,#06,#6a,#00,#06,#35,#00,#06
	db #6a,#00,#06,#6a,#00,#06,#35,#00
	db #06,#6a,#00,#06,#6a,#00,#06,#35
	db #00,#06,#6a,#00,#06,#6a,#00,#06
	db #35,#00,#06,#6a,#00,#06,#6a,#00
	db #06,#6a,#00,#06,#00,#00,#ff,#00
.l8747 equ $ + 1
	db #00,#06,#2d,#00,#06,#59,#00,#06
	db #59,#00,#06,#2d,#00,#06,#59,#00
	db #06,#59,#00,#06,#2d,#00,#06,#59
	db #00,#06,#28,#00,#06,#50,#00,#06
	db #50,#00,#06,#28,#00,#06,#50,#00
	db #06,#50,#00,#06,#28,#00,#06,#50
.l877d equ $ + 7
	db #00,#06,#00,#00,#ff,#00,#00,#06
	db #24,#00,#06,#47,#00,#06,#47,#00
	db #06,#24,#00,#06,#47,#00,#06,#47
	db #00,#06,#47,#00,#06,#47,#00,#06
	db #47,#00,#06,#5f,#00,#06,#47,#00
	db #06,#3f,#00,#0c,#00,#00,#0c,#77
.l87ad equ $ + 7
	db #00,#06,#00,#00,#ff,#00,#00,#06
	db #2d,#00,#06,#59,#00,#06,#59,#00
	db #06,#2d,#00,#06,#59,#00,#06,#59
	db #00,#06,#59,#00,#06,#59,#00,#06
	db #47,#00,#06,#59,#00,#06,#47,#00
	db #06,#3f,#00,#0c,#00,#00,#0c,#3c
.l87dd equ $ + 7
	db #00,#06,#00,#00,#ff,#00,#00,#06
	db #3c,#00,#06,#77,#00,#06,#77,#00
	db #06,#3c,#00,#06,#77,#00,#06,#77
	db #00,#06,#77,#00,#06,#77,#00,#06
	db #3c,#00,#06,#50,#00,#06,#3c,#00
	db #06,#35,#00,#0c,#00,#00,#0c,#2f
	db #00,#06,#00,#00,#ff,#00,#00,#ff
.l8810 equ $ + 2
	db #ff,#ff,#60,#00,#00,#06,#00,#00
.l8819 equ $ + 3
	db #ff,#00,#00,#03,#1c,#01,#03,#0c
	db #01,#03,#fd,#00,#03,#ef,#00,#03
	db #e1,#00,#03,#d5,#00,#03,#c9,#00
	db #03,#be,#00,#03,#b3,#00,#03,#a9
	db #00,#03,#9f,#00,#03,#96,#00,#03
	db #8e,#00,#03,#86,#00,#03,#7f,#00
	db #03,#77,#00,#03,#7f,#00,#03,#86
	db #00,#03,#8e,#00,#03,#96,#00,#03
	db #9f,#00,#03,#a9,#00,#03,#b3,#00
	db #03,#be,#00,#03,#c9,#00,#03,#d5
	db #00,#03,#e1,#00,#03,#ef,#00,#03
	db #fd,#00,#03,#0c,#01,#03,#1c,#01
	db #03,#2d,#01,#06,#00,#00,#ff,#00
.l887f equ $ + 1
	db #00,#03,#ef,#00,#03,#e1,#00,#03
	db #d5,#00,#03,#c9,#00,#03,#be,#00
	db #03,#b3,#00,#03,#a9,#00,#03,#9f
	db #00,#03,#96,#00,#03,#8e,#00,#03
	db #86,#00,#03,#7f,#00,#03,#77,#00
	db #03,#71,#00,#03,#6a,#00,#03,#64
	db #00,#03,#6a,#00,#03,#71,#00,#03
	db #77,#00,#03,#7f,#00,#03,#86,#00
	db #03,#8e,#00,#03,#96,#00,#03,#9f
	db #00,#03,#a9,#00,#03,#b3,#00,#03
	db #be,#00,#03,#c9,#00,#03,#d5,#00
	db #03,#e1,#00,#03,#ef,#00,#03,#fd
.l88e5 equ $ + 7
	db #00,#06,#00,#00,#ff,#00,#00,#03
	db #3f,#01,#03,#2d,#01,#03,#1c,#01
	db #03,#0c,#01,#03,#fd,#00,#03,#ef
	db #00,#03,#e1,#00,#03,#d5,#00,#03
	db #c9,#00,#03,#be,#00,#03,#b3,#00
	db #03,#a9,#00,#03,#9f,#00,#03,#96
	db #00,#03,#8e,#00,#03,#86,#00,#03
	db #8e,#00,#03,#96,#00,#03,#9f,#00
	db #03,#a9,#00,#03,#b3,#00,#03,#be
	db #00,#03,#c9,#00,#03,#d5,#00,#03
	db #e1,#00,#03,#ef,#00,#03,#fd,#00
	db #03,#0c,#01,#03,#1c,#01,#03,#2d
	db #01,#03,#3f,#01,#03,#52,#01,#06
.l894b equ $ + 5
	db #00,#00,#ff,#00,#00,#06,#8e,#00
	db #06,#be,#00,#06,#8e,#00,#06,#7f
	db #00,#0c,#00,#00,#0c,#77,#00,#30
	db #8e,#00,#06,#00,#00,#ff,#00,#00
.l8966
	db #06,#8e,#00,#06,#b3,#00,#06,#8e
	db #00,#06,#7f,#00,#0c,#00,#00,#0c
	db #77,#00,#30,#8e,#00,#06,#00,#00
.l8981 equ $ + 3
	db #ff,#00,#00,#06,#77,#00,#06,#9f
	db #00,#06,#77,#00,#06,#6a,#00,#0c
	db #00,#00,#0c,#5f,#00,#0c,#6a,#00
	db #0c,#77,#00,#0c,#59,#00,#06,#5f
	db #00,#06,#6a,#00,#06,#00,#00,#ff
.l89a8 equ $ + 2
	db #00,#00,#18,#6a,#00,#0c,#00,#00
	db #0c,#77,#00,#0c,#7f,#00,#0c,#8e
	db #00,#0c,#7f,#00,#06,#77,#00,#06
	db #8e,#00,#06,#00,#00,#ff,#00,#00
.l89c6
	db #03,#1c,#01,#03,#0c,#01,#03,#fd
	db #00,#03,#ef,#00,#03,#e1,#00,#03
	db #d5,#00,#03,#c9,#00,#03,#be,#00
	db #03,#b3,#00,#03,#a9,#00,#03,#9f
	db #00,#03,#96,#00,#03,#8e,#00,#03
	db #86,#00,#03,#7f,#00,#03,#77,#00
	db #03,#1c,#01,#03,#0c,#01,#03,#fd
	db #00,#03,#ef,#00,#03,#e1,#00,#03
	db #d5,#00,#03,#c9,#00,#03,#be,#00
	db #03,#b3,#00,#03,#a9,#00,#03,#9f
	db #00,#03,#96,#00,#03,#8e,#00,#03
	db #86,#00,#03,#7f,#00,#03,#77,#00
.l8a2c equ $ + 6
	db #06,#00,#00,#ff,#00,#00,#06,#6a
	db #00,#06,#8e,#00,#06,#6a,#00,#06
	db #5f,#00,#0c,#00,#00,#0c,#59,#00
	db #30,#6a,#00,#06,#00,#00,#ff,#00
.l8a47 equ $ + 1
	db #00,#03,#47,#00,#03,#4b,#00,#03
	db #50,#00,#03,#54,#00,#03,#59,#00
	db #03,#5f,#00,#03,#64,#00,#03,#6a
	db #00,#03,#71,#00,#03,#77,#00,#03
	db #7f,#00,#03,#86,#00,#03,#8e,#00
	db #03,#96,#00,#03,#9f,#00,#03,#a9
	db #00,#03,#b3,#00,#03,#be,#00,#03
	db #c9,#00,#03,#d5,#00,#03,#e1,#00
	db #03,#ef,#00,#03,#fd,#00,#03,#0c
	db #01,#03,#1c,#01,#03,#2d,#01,#03
	db #3f,#01,#03,#52,#01,#03,#66,#01
	db #03,#7b,#01,#03,#92,#01,#03,#aa
	db #01,#06,#00,#00,#ff,#00,#00,#ff
.l8ab0 equ $ + 2
	db #ff,#ff,#60,#00,#00,#06,#00,#00
.l8ab9 equ $ + 3
	db #ff,#00,#00,#0c,#1c,#01,#0c,#38
	db #02,#0c,#1c,#01,#0c,#38,#02,#0c
	db #1c,#01,#0c,#38,#02,#0c,#1c,#01
	db #0c,#38,#02,#06,#00,#00,#ff,#00
.l8ad7 equ $ + 1
	db #00,#0c,#66,#01,#0c,#cc,#02,#0c
	db #66,#01,#0c,#cc,#02,#0c,#66,#01
	db #0c,#cc,#02,#0c,#66,#01,#0c,#cc
.l8af5 equ $ + 7
	db #02,#06,#00,#00,#ff,#00,#00,#0c
	db #ef,#00,#0c,#de,#01,#0c,#ef,#00
	db #0c,#de,#01,#0c,#ef,#00,#0c,#de
	db #01,#0c,#ef,#00,#0c,#de,#01,#06
.l8b13 equ $ + 5
	db #00,#00,#ff,#00,#00,#0c,#3f,#01
	db #0c,#7e,#02,#0c,#3f,#01,#0c,#7e
	db #02,#0c,#3f,#01,#0c,#7e,#02,#0c
	db #3f,#01,#0c,#7e,#02,#06,#00,#00
.l8b31 equ $ + 3
	db #ff,#00,#00,#0c,#d5,#00,#0c,#aa
	db #01,#0c,#d5,#00,#0c,#aa,#01,#0c
	db #d5,#00,#0c,#aa,#01,#0c,#d5,#00
	db #0c,#aa,#01,#06,#00,#00,#ff,#00
.l8b4f equ $ + 1
	db #00,#06,#66,#01,#06,#66,#01,#06
	db #66,#01,#06,#66,#01,#06,#66,#01
	db #06,#66,#01,#06,#66,#01,#06,#66
	db #01,#06,#3f,#01,#06,#3f,#01,#06
	db #3f,#01,#06,#3f,#01,#06,#3f,#01
	db #06,#3f,#01,#06,#3f,#01,#06,#3f
	db #01,#06,#00,#00,#ff,#00,#00,#ff
.l8b88 equ $ + 2
	db #ff,#ff,#0e,#0e,#0e,#0c,#0c,#0c
	db #0e,#0e,#0e,#0c,#0f,#0f,#0d,#0d
	db #0f,#0f,#0d,#0d,#0f,#0f,#0f,#0f
	db #0f,#0d,#0d,#0c,#0a,#09,#07,#05
	db #20,#12,#00,#00,#00,#00,#87,#87
	db #8a,#00,#87,#87,#4f,#06,#47,#87
	db #c7,#47,#82,#00,#00,#00,#00,#41
	db #0f,#c7,#00,#41,#0f,#87,#8b,#09
	db #8f,#c3,#8b,#cb,#00,#00,#00,#00
	db #00,#41,#c3,#c3,#00,#41,#c3,#c3
	db #c3,#c3,#c3,#c3,#c3,#c3,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#c7,#cf,#00,#41,#8b,#09,#8f
	db #4b,#8b,#cb,#4b,#cf,#8a,#00,#00
	db #00,#00,#00,#87,#4f,#00,#41,#8b
	db #09,#8f,#4b,#8b,#cb,#4b,#0f,#8a
	db #00,#00,#00,#00,#41,#87,#8a,#00
	db #c7,#06,#47,#0f,#c7,#47,#87,#87
	db #4f,#00,#00,#00,#00,#00,#41,#c3
	db #82,#00,#c3,#c3,#c3,#c3,#c3,#c3
	db #c3,#c3,#c3,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#41,#cf,#c3
	db #8b,#47,#4b,#c7,#47,#87,#c3,#87
	db #c3,#cf,#00,#00,#00,#00,#00,#41
	db #0f,#87,#03,#8f,#87,#c7,#47,#87
	db #c3,#0f,#87,#4f,#00,#00,#00,#00
	db #00,#87,#4b,#c7,#47,#4b,#4b,#8b
	db #cb,#4b,#87,#4b,#87,#8a,#00,#00
	db #00,#00,#00,#c3,#c3,#c3,#c3,#c3
	db #c3,#c3,#c3,#c3,#c3,#c3,#c3,#82
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00
	
.l0064
	dw 0
.l0066
	dw #25b4
	l7522
	dw 0
;org #65d9
;
.init_music		; added by Megachur
;
	ld hl,l8566
	ld (l0064),hl
	jp l834a
;
.game_name
	db "Meganova",0
.game_year
	db "1988",0
.game_publisher
	db "Dinamic",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
